const http = require("http")
const url = require("url")
const qs = require("querystring")

const server = http.createServer((req, res) => {
  console.log(req.method);
  const { pathname } = url.parse(req.url)
  console.log(pathname);
  req.setEncoding("utf-8")
  req.on('data', (data) => {
    console.log(data);
    // console.log(data.toString());

    console.log(JSON.parse(data));
   
  })

 res.end('end')
})
//0.0.0.0可以监听ipv4地址
server.listen(8000, '0.0.0.0', () => {
  console.log("服务器启动成功");
  console.log(server.address().port);
})